<style scoped>

</style>
<template>
    <FormSection @store="login">
        <template #title>用户登录</template>
        <template #input-group>
            <div class="form-group">
                <Label name="email" label="邮箱"></Label>
                <InputText name="email" v-model="form.email" @keyup="clear('email')"></InputText>
                <ErrorMsg :error="form.errors.get('email')"></ErrorMsg>
            </div>
            <div class="form-group">
                <Label name="password" label="密码"></Label>
                <InputText type="password" name="title" v-model="form.password" @keyup="clear('password')"></InputText>
                <ErrorMsg :error="form.errors.get('password')"></ErrorMsg>
            </div>
        </template>
        <template #action>
            <Button type="submit">登录</Button>
        </template>
        <template slot="toast">
            <SuccessMsg :success="form.success">用户登录成功</SuccessMsg>
        </template>
    </FormSection>
</template>
<script>
import FormSection from './form/FormSection';
import InputText from './form/InputText';
import Button from './form/Button';
import SuccessMsg from './form/SuccessMsg'
import Label from './form/Label';
import ErrorMsg from './form/ErrorMsg';
export default {
    components: {FormSection, InputText, Label, SuccessMsg, Button, ErrorMsg},
    data() {
        return {
            form: new Form({
                email: '',
                password:'',
            })
        }
    },
    methods: {
        login(){
            this.form.post('/user/login')
        }
    }
}
</script>
